import { IPSModelSortable } from '../../ipsmodel-sortable';
import { IPSAppDEField } from './ipsapp-defield';
import { IPSAppDERS } from './ipsapp-ders';
import { IPSAppDataEntity } from './ipsapp-data-entity';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSAppDERSImpl2 extends PSModelObjectImpl implements IPSAppDERS, IPSModelSortable {
  get actionRSMode(): 0 | 1 | 2 {
    return this.M.actionRSMode;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  get codeName2(): string {
    return this.M.codeName2;
  }

  get dataRSMode(): 1 | 2 | 4 | 8 {
    return this.M.dataRSMode;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get majorDECodeName(): string {
    return this.M.majorDECodeName;
  }

  get majorDECodeName2(): string {
    return this.M.majorDECodeName2;
  }

  get majorDEName(): string {
    return this.M.majorDEName;
  }

  protected majorpsappdataentity: IPSAppDataEntity | null = null;

  getMajorPSAppDataEntity(): IPSAppDataEntity | null {
    if (this.majorpsappdataentity != null) return this.majorpsappdataentity;
    const value = this.M.getMajorPSAppDataEntity;
    if (value == null) {
      return null;
    }
    this.majorpsappdataentity = this.getPSModel4('app.dataentity.IPSAppDataEntity', value, 'getMajorPSAppDataEntity') as IPSAppDataEntity;
    return this.majorpsappdataentity;
  }

  get majorPSAppDataEntity(): IPSAppDataEntity | null {
    return this.getMajorPSAppDataEntity();
  }

  getMajorPSAppDataEntityMust(): IPSAppDataEntity {
    const value = this.getMajorPSAppDataEntity();
    if (value == null) {
      throw new Error('未指定主应用实体对象');
    }
    return value;
  }

  get memo(): string {
    return this.M.memo;
  }

  get minorDECodeName(): string {
    return this.M.minorDECodeName;
  }

  get minorDECodeName2(): string {
    return this.M.minorDECodeName2;
  }

  get minorDEName(): string {
    return this.M.minorDEName;
  }

  protected minorpsappdataentity: IPSAppDataEntity | null = null;

  getMinorPSAppDataEntity(): IPSAppDataEntity | null {
    if (this.minorpsappdataentity != null) return this.minorpsappdataentity;
    const value = this.M.getMinorPSAppDataEntity;
    if (value == null) {
      return null;
    }
    this.minorpsappdataentity = this.getPSModel4('app.dataentity.IPSAppDataEntity', value, 'getMinorPSAppDataEntity') as IPSAppDataEntity;
    return this.minorpsappdataentity;
  }

  get minorPSAppDataEntity(): IPSAppDataEntity | null {
    return this.getMinorPSAppDataEntity();
  }

  getMinorPSAppDataEntityMust(): IPSAppDataEntity {
    const value = this.getMinorPSAppDataEntity();
    if (value == null) {
      throw new Error('未指定从应用实体对象');
    }
    return value;
  }

  get name(): string {
    return this.M.name;
  }

  get orderValue(): number {
    return this.M.orderValue;
  }

  get parentFilter(): string {
    return this.M.parentFilter;
  }

  protected parentpsappdefield: IPSAppDEField | null = null;

  getParentPSAppDEField(): IPSAppDEField | null {
    if (this.parentpsappdefield != null) return this.parentpsappdefield;
    const value = this.M.getParentPSAppDEField;
    if (value == null) {
      return null;
    }
    this.parentpsappdefield = this.getMinorPSAppDataEntityMust().findPSAppDEField(value);
    return this.parentpsappdefield;
  }

  get parentPSAppDEField(): IPSAppDEField | null {
    return this.getParentPSAppDEField();
  }

  getParentPSAppDEFieldMust(): IPSAppDEField {
    const value = this.getParentPSAppDEField();
    if (value == null) {
      throw new Error('未指定父关系连接属性');
    }
    return value;
  }

  get rSMode(): 1 | 2 {
    return this.M.rSMode;
  }

  get tempDataOrder(): number {
    return this.M.tempDataOrder != null ? this.M.tempDataOrder : -1;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get array(): boolean {
    return this.M.array != null ? this.M.array : true;
  }

  get enableCreateDataRS(): boolean {
    return this.M.enableCreateDataRS != null ? this.M.enableCreateDataRS : false;
  }

  get enableGetDataRS(): boolean {
    return this.M.enableGetDataRS != null ? this.M.enableGetDataRS : false;
  }

  get enableSelectDataRS(): boolean {
    return this.M.enableSelectDataRS != null ? this.M.enableSelectDataRS : false;
  }

  get enableUpdateDataRS(): boolean {
    return this.M.enableUpdateDataRS != null ? this.M.enableUpdateDataRS : false;
  }

  get majorDEMajor(): boolean {
    return this.M.majorDEMajor != null ? this.M.majorDEMajor : true;
  }

  get cls(): string {
    return 'PSAppDERSImpl2';
  }

  instanceof(cls: string): boolean {
    if (cls == 'IPSModelSortable' || cls == 'app.dataentity.IPSAppDERS') return true;
    return super.instanceof(cls);
  }
}
